Skip to content

fix(macos): publish Unset prefs too — they carry the catalog default#68

Merged
fullstackjam merged 1 commit into
mainfrom
fix/macos-publish-unset-prefs-too
May 16, 2026
Merged

fix(macos): publish Unset prefs too — they carry the catalog default#68
fullstackjam merged 1 commit into
mainfrom
fix/macos-publish-unset-prefs-too

Conversation

@fullstackjam
Copy link
Copy Markdown
Collaborator

Summary

Fixes the bug introduced by #67. Live verification on @fullstackjam's machine showed:

  • defaults read com.apple.controlcenter "NSStatusItem Visible Sound"does not exist
  • ./openboot snapshot --json --dry-run → Sound captured with unset: true
  • TUI editor → Sound defaulted to unselected
  • buildImportConfig → Sound filtered out
  • Web UI → Menu Bar shows "1" unchecked

The reasoning behind #67's filter ("Unset means user had no opinion, don't propagate") was wrong: macOS does not write default-equal values to the plist, so any pref the user has never explicitly touched but which macOS displays by default captures as Unset. Filtering those dropped 8/9 Menu Bar items and similar across other categories.

Fix treats Unset as purely informational metadata:

  • internal/cli/snapshot_import.go — drop the boundary filter; pass through every captured pref. Unset entries carry the catalog default Value, which is the value we'd want enforced regardless.
  • internal/ui/snapshot_editor.go — default Unset entries to selected. The (unset, default = X) badge in the description stays so users can see which prefs originated from catalog vs explicit plist.
  • internal/diff/compare.go — unchanged. diffMacOS already treats Unset as "no opinion" on either side, which is the right semantic for diff (about state mismatch) but not for publish (about transmitting configured state).

After this PR, ./openboot snapshot --json --dry-run | jq '[.macos_prefs[] | select(.domain=="com.apple.controlcenter")] | length' returns 9 instead of being silently filtered down to whatever the user's plist happens to contain.

Test plan

  • make test-unit green (with two tests renamed + inverted to match the new contract).
  • Local rebuild → ./openboot snapshot --json --dry-run now reports all 9 Menu Bar prefs.
  • CI green.

#67 filtered Unset entries at the snapshot→state boundary and defaulted
them to unselected in the TUI editor. The reasoning ("Unset means user
had no opinion, don't propagate") was wrong: macOS does not write
default-equal values to the plist, so common cases like "Show Sound in
menu bar" — a key the user has never explicitly touched but which
macOS displays by default — capture as Unset. Filtering them dropped
8 of 9 Menu Bar items from publish and the web UI showed only "1",
unchecked.

Treat Unset as purely informational metadata going forward:

- internal/cli/snapshot_import.go — drop the boundary filter; publish
  every captured pref (Unset entries carry the catalog default, which
  is the value we'd want to enforce regardless).
- internal/ui/snapshot_editor.go — default Unset entries to selected.
  The `(unset, default = X)` badge in the description stays, so users
  can see which prefs originated from the catalog default vs the user's
  explicit plist value, but the default action is to include them.
- internal/diff/compare.go — unchanged; diffMacOS already treats Unset
  as "no opinion" on either side, which remains the right semantic for
  diff (vs publish, which is about transmitting the configured state).

Tests inverted to match (and renamed so the new contract is obvious).
@github-actions github-actions Bot added tests Tests only ui Terminal UI labels May 16, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullstackjam fullstackjam merged commit 75ce3c8 into main May 16, 2026
13 checks passed
@fullstackjam fullstackjam deleted the fix/macos-publish-unset-prefs-too branch May 16, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests only ui Terminal UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant